#ifndef __VAG_H
#define __VGA_H

#include <hardwarecommunication/port.h>

class Vga
{
private:
    /* data */
    static const unsigned char g_8x8_font[2048];

protected:
    Port8Bit miscPort;
    Port8Bit crtcIndexPort;
    Port8Bit crtcDataPort;
    Port8Bit sequenceIndexPort;
    Port8Bit sequenceDataPort;
    Port8Bit graphicsControllerIndexPort;
    Port8Bit graphicsControllerDataPort;
    Port8Bit attributeControllerIndexPort;
    Port8Bit attributeControllerReadPort;
    Port8Bit attributeControllerWritePort;
    Port8Bit attributeControllerResetPort;

    void WriteRegister(uint8_t* registers);
    uint8_t* GetFrameBufferSegment();
    virtual bool PutPixel(int32_t x, int32_t y, uint8_t colorCode);
    virtual uint8_t GetColorIndex(uint8_t r, uint8_t g, uint8_t b);
public:
    Vga();
    ~Vga();
    virtual bool SetMode(uint32_t width, uint32_t heaight, uint32_t colorDepth);
    virtual bool SupportMode(uint32_t width, uint32_t heaight, uint32_t colorDepth);
    virtual bool PutPixel(int32_t x, int32_t y, uint8_t r, uint8_t g, uint8_t b);
    virtual void PutFont(int32_t x, int32_t y, uint32_t index);
    virtual bool FillRectangle(int32_t x, int32_t y, int32_t w, int32_t h,uint8_t r, uint8_t g, uint8_t b);
};




#endif